// JavaScript Document
$(function(){
	$("ul[class=nav]>li").each(function() {
		var html = $(this).html();
		$(this).html('<span class="mouseout">'+html+'</span>');
		$(this).append('<span class="mouseover">'+html+'</span>');
	});
	$("ul[class=nav]>li").hover(function() {
		$(".mouseout",	this).stop().animate({'top':	'40px'},	300); // move down - hide
		$(".mouseover",	this).stop().animate({'top':	'0px'},		300); // move down - show

	}, function() {
		$(".mouseout",	this).stop().animate({'top':	'0px'},		300); // move up - show
		$(".mouseover",	this).stop().animate({'top':	'-40px'},	300); // move up - hide
	});
	
	setInterval('active()',2000);
});

function active(){
	$(function(){
		$('ul[class=active] li').eq(0).fadeOut('slow',function(){        
			$(this).clone().appendTo($(this).parent()).fadeIn('slow');
			$(this).remove();
		});
	});
}

$.fn.flvPlayer = function(file,width,height){
	var temp = "";
	width = width || 600;
	height= height || 500;
	var url = PUBLIC+"include/JcStesPlayer.swf?movUrl="+PUBLIC+"../Video/"+file;
	temp += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96B8-444553540000\"";
	temp += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.47.0\" width=\""+width+"\" height=\""+height+"\">";
	temp += "<param name=\"allowScriptAccess\" value=\"always\" />";
	temp += "<param name=\"movie\" value=\""+url+"\" />";
	temp += "<param name=\"flashvars\" value=\"\" />";
	temp += "<param name=\"menu\" value=\"false\" />";
	temp += "<param name=\"quality\" value=\"high\" />";
	temp += "<param name=\"wmode\" value=\"transparent\" />";
	temp += "<param name=\"bgcolor\" value=\"\" />";
	temp += "<embed src=\""+url+"\" flashvars=\"\" allowScriptAccess=\"always\" menu=\"false\" quality=\"high\" wmode=\"transparent\"";
	temp += "devicefont=\"true\" bgcolor=\"#ffffff\"  width=\""+width+"\" height=\""+height+"\" align=\"middle\" type=\"application/x-shockwave-flash\"";
	temp += "pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">";
	temp += "</embed>";
	temp += "</object>";
	return this.html(temp);
}
$.fn.flash = function(width,height,arr,fontHeight){
	if(!fontHeight){fontHeight=0}
	var pics="",links="",texts="";
	for(var i=0;i<arr.length;i++){
		pics += arr[i][0]+"|";
		texts += arr[i][1]+"|";
		links += escape(arr[i][2])+"|";
	}
	pics = pics.substring(0,pics.length-1);
	links = links.substring(0,links.length-1);
	texts = texts.substring(0,texts.length-1);
	var flashvars = 'pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+width+'&borderheight='+height+'&textheight='+fontHeight;
	var temp="";
	temp += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width +'" height="'+ (height+fontHeight) +'">';
	temp += '<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+TMPL+'include/focus.swf"><param name="quality" value="high">';
	temp += '<param name="menu" value="false"><param name=wmode value="opaque">';
	temp += '<param name="FlashVars" value="'+flashvars+'">';
	temp += '<embed wmode="Transparent" src="'+TMPL+'include/focus.swf" flashvars="'+flashvars+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width +'" height="'+ (height+fontHeight) +'">';
	temp += '</object>';
	return this.html(temp);
}
function SetHome(url){
	if( typeof(url) == "undefined" ) url = location.protocol + '//' + location.host;
	if( typeof(document.all) == 'object' ) {
		document.body.style.behavior = "url(#default#homepage)";
		document.body.setHomePage(url);
	}else if( typeof(sidebar) == 'object' && typeof(netscape) == 'object' ) {
		try{
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch).setCharPref('browser.startup.homepage',url);
			alert('成功设置 '+url+' 为Firefox首页');
		} catch (e) { alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" ); }
	}else alert('您使用的浏览器不支持javascript设为首页！\n请手动设置，或使用IE/火狐浏览器！');
}
function AddFavorite(sURL, sTitle) {   
    try {   
        window.external.addFavorite(sURL, sTitle);   
    } catch (e) {   
        try {   
            window.sidebar.addPanel(sTitle, sURL, "");   
        } catch (e) {   
            alert("加入收藏失败，请使用Ctrl+D进行添加");   
        }   
    }   
}   
